package com.hang.ixin.netty;

import io.netty.channel.Channel;

import java.util.HashMap;
import java.util.Map;

public class UserChannelMap {
    private static Map<String, Channel> map = new HashMap<>();

    public static void put(String id, Channel channel) {
        map.put(id, channel);
    }

    public static Channel get(String id) {
        return map.get(id);
    }

    public static void outprint() {
        for (Map.Entry<String, Channel> entry : map.entrySet()) {
            System.out.println("用户id:" + entry.getKey() + " 用户频道:" + entry.getValue().id().asLongText());
        }
    }
}
